﻿//-----------------------------------------------------------------------
// <copyright file="DateTimePickerFieldDefinition.cs" company="Jamie Knight">
// Copyright (c) Jamie Knight. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
using System.Windows;
using System.Windows.Data;
using DevKnightlie.WPF.AutoForm.FieldDefinitions;
using Xceed.Wpf.Toolkit;

namespace DevKnightlie.WPF.AutoForm.WPFToolkit.FieldDefinitions
{
    /// <summary>
    /// Field definition which builds a DateTimePicker control
    /// </summary>
    public class DateTimePickerFieldDefinition:BaseFieldDefinition
    {
        #region Methods

        public override void BuildInputControl()
        {
            DateTimePicker dateTimePicker = new DateTimePicker()
            {
                HorizontalContentAlignment = HorizontalAlignment.Left,
                VerticalContentAlignment = VerticalAlignment.Center
            };
            Binding valueBinding = new Binding(PropertyName);
            BindingOperations.SetBinding(dateTimePicker, DateTimePicker.ValueProperty, valueBinding);
            SetupEnabledBinding(dateTimePicker);
            InputControl = ContainerControl = dateTimePicker;
        }



        #endregion
    }
}
